﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using XingNet.Web.Communication;
using XingNet.Web.Communication.Base;
using XingNet.Web.Model.v1_Users;
using Xunit;

namespace XingNet.Web.Communication.Requests.v1_Users
{
  public class Users
  {
    [JsonProperty(PropertyName = "users")]
    public UserProfile[] UserProfiles { get; set; }
  }

#region FindByMail
    public class FindByMail
  {
    [JsonProperty(PropertyName = "total")]
    public int Total { get; set; }

    [JsonProperty(PropertyName = "items")]
    public FindByMail_Items Items { get; set; }
  }

  public class FindByMail_Items
  {
    [JsonProperty(PropertyName = "email")]
    public string Email { get; set; }
    [JsonProperty(PropertyName = "user")]
    public User_Lazy User { get; set; }
  }
  public class User_Lazy
  {
    [JsonProperty(PropertyName = "id")]
    public string ID;

    private UserProfile _Profile;
    public UserProfile Profile(XingNetTokenHandler _TokenHandler, bool ForceReload = false)
    {
      if (_Profile == null || ForceReload == true)
      {
        v1_Users_Request UserRequest = new v1_Users_Request(_TokenHandler);
        Users Response = UserRequest.GetUserByID(new string[] { ID.ToString() });
        return Response.UserProfiles[0];
      }
      else
      {
        return _Profile;
      }
    }

  }
  
#endregion





  public class v1_Users_IDCard
  {


  }
}
